use actix_web::{App, HttpServer};

use crate::{cfg::WEB_ADDR, error::IoErr};



mod req;
mod res;
mod api;

pub async fn init() -> Result<(), IoErr> {
    println!("服务器启动:{}", WEB_ADDR);

    let app = || {
        App::new()
        .configure(api::register)
    };

    HttpServer::new(app)
        .bind(WEB_ADDR)?
        .run()
        .await?;
    Ok(())
}
